home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
mail
/
mh
/
contrib
/
jpeek
/
tofrom
< prev
next >
Wrap
Text File
|
1992-08-08
|
2KB
|
71 lines
#! /bin/sh
# $Header: /home/jerry/.bin/RCS/tofrom,v 1.6 92/08/09 23:26:36 jerry mh_contrib $
#
### tofrom - scan for mail to or from a user
### Usage: tofrom -u user [+folder] [messages]
##
## DOES pick -lbr -to USER -or -fr USER -rbr [+fol] [msgs] -seq picked
## (ALSO INCLUDES apparently-from: AND apparently-to: HEADERS.)
## THEN DOES scan picked
#
# NOTE TO HACKERS: TABSTOPS ARE SET AT 4 IN THIS CODE
#
# USE AT YOUR OWN RISK. SEEMS TO WORK, BUT IT'S YOUR RESPONSIBILITY!
# PLEASE TELL ME ABOUT BUGS AND FIXES: Jerry Peek, jerry@ora.com
myname="`basename $0`"
usage="Usage: $myname -u user [+folder] [messages]"
while :
do
case "$1" in
"") break ;; # NO MORE ARGUMENTS
+*) folder="$1" ;;
-h*)
echo "$usage" 1>&2
exit 0
;;
-u) case "$2" in
""|[-+]*)
echo "${2}?? bad or missing argument after '-u'.
$usage" 1>&2
exit 1
;;
*) case "$who" in
"") who="$2"
shift # shift OFF $1 (WE'LL shift $2 AT END OF LOOP)
;;
*) echo "$myname: ${2}?? Only one username, please." 1>&2
echo "$usage" 1>&2
exit 1
;;
esac
;;
esac
;;
-*) echo "$usage
(no options, please; I don't understand '$1')" 1>&2
exit 1
;;
*) msgs="$msgs $1" ;;
esac
shift
done
case "$who" in
"") echo "$usage
(missing username)" 1>&2
exit 1
;;
*) if pick -lbr -to "$who" -or -from "$who" -or --apparently-to "$who" \
-or --apparently-from "$who" -rbr $folder $msgs -seq picked
then
# THIS exitS WITH scan'S EXIT STATUS:
scan picked
exit
else
exit 1
fi
;;
esac